<?php require_once(dirname(__FILE__)."/../../../globals.inc"); $mikron->Page->StartBody(); ?>
    <h1>Обновления:</h1>
<?php

    /*$r = mysql_query('select `name` from entities');
    while($row=mysql_fetch_object($r))
    {
        $name = $row->name;
        $a = $mikron->EntityManager->Query($name);
        foreach($a as $e)
        {
            $e->Save(true);
        }
    }*/

    needlogged();
    ?>&nbsp;<?php
    $selectedsoft = 0;
    if(isset($_GET['soft']))
    {
        $selectedsoft = (int)$_GET['soft'];
    }

      $updates = $mikron->EntityManager->Query("T_FILE", null, new Criterion('soft', $selectedsoft));
      $showall = false;
      if(isset($_POST['showall']))
      {
        $showall = true;    
      }
      if(count($updates)==0)
      {
          if($selectedsoft==0)
          {
            ?>{{$SELECT_UPDATE_SOFT}}<?php              
          }
          else
          {
            ?><br />Для данного продукта нет обновлений.<?php
          }
      }
      else
      {
          ?><table width="100%" border="0" class="softversionstable" cellpadding="2" cellspacing="0"><?php
          $c = 0;
          foreach($updates as $update)
          {
            echo $update->toString(); 
            $c++;
            if($c == 4)
            {
                if(!$showall)
                {
                    break;
                }
            }
          }
          ?></table><?php
          if(!$showall)
          {
              if($c>=4)
              {
                ?><br />
                <form method="POST" action="<?php echo $_SERVER['REQUEST_URI']; ?>"><input type="hidden" name="showall" value="yes">
                <input type="submit" value="Показать все обновления">
                </form>
                <?php
              }          
          }
      }

?>
<?php $mikron->Page->EndBody(); ?>